<div>
    <div class="eChart-div">
        <div id="revenue_pie" style="width: 42%;height: 400px"></div>
        <div id="revenue_line" style="width: 56%;height: 400px;"></div>
    </div>
    <div class="canvas_space marginT_5"></div>
    <div class="eChart-div">
        <div id="money_pie" style="width: 42%;height: 400px"></div>
        <div id="money_line" style="width: 56%;height: 400px"></div>
    </div>
    <div class="canvas_space marginT_5"></div>
    <div class="eChart-div">
        <div id="money_bar" style="width: 42%;height:400px"></div>
        <div id="goods_bar" style="width: 56%;height:400px"></div>
    </div>
</div>

<script type="text/javascript">
    var revenue = JSON.parse('{!! $revenue !!}');
    var money = JSON.parse('{!! $money !!}');
    var goods = JSON.parse('{!! $goods !!}');

    var revenuePie = {
        id:'revenue_pie',
        title:'营收统计（总）',
        legend:['水票营收','零售营收'],
        series:[
            {
                name:'营收统计（总桶数/桶）',
                data:[
                    {value:parseFloat(revenue.bill_num), name:'水票桶数'},
                    {value:parseFloat(revenue.order_num), name:'零售桶数'}
                ],
            },
            {
                name:'营收统计（总金额/元）',
                data:[
                    {value:parseFloat(revenue.total_bill), name:'水票营收'},
                    {value:parseFloat(revenue.total_order), name:'零售营收'}
                ]
            }
        ]
    }

    var moneyPie = {
        id:'money_pie',
        title:'支付方式（总）/元',
        legend:['微信支付','货到付款'],
        series:[
            {value:parseFloat(money.total_online), name:'微信支付'},
            {value:parseFloat(money.total_offline), name:'货到付款'}
        ]
    }

    var revenueLine = {
        id:'revenue_line',
        title:'营收统计/元',
        legend:['水票营收', '零售营收'],
        category:[],
        series:[{
            name:'水票营收',
            type:'line',
            smooth:true,
            data:[]
        }, {
            name:'零售营收',
            type:'line',
            smooth:true,
            data:[]
        }]
    }
    $.each(revenue.data, function(i,val){
        revenueLine.category.push(i);
        revenueLine.series[0].data.push(parseFloat(val.billOrder));
        revenueLine.series[1].data.push(parseFloat(val.order));
    })

    var moneyLine = {
        id:'money_line',
        title:'支付方式统计/元',
        legend:['微信支付', '货到付款'],
        category:[],
        series:[{
            name:'微信支付',
            type:'line',
            smooth:true,
            data:[]
        },{
            name:'货到付款',
            type:'line',
            smooth:true,
            data:[]
        }]
    }
    $.each(money.data,function(i,val) {
        moneyLine.category.push(i);
        moneyLine.series[0].data.push(parseFloat(val.online));
        moneyLine.series[1].data.push(parseFloat(val.offline));
    })

    var goodsBar = {
        id:'goods_bar',
        title: '款项商品分类统计/元',
        legend: ['订单款', '水票款'],
        category:[],
        series:{
            0:[],
            1:[]
        }
    }
    $.each(goods, function (i,val) {
        goodsBar.category.push(val.goods_name)
        goodsBar.series[0].push(parseFloat(val.total_bill_amount))
        goodsBar.series[1].push(parseFloat(val.total_order_amount))
    })

    var moneyCatePie = {
        id:'money_bar',
        title:'款项分类统计/元',
        legend:['水票款','订单款'],
        series:[
            {value:parseFloat(money.total_bill), name:'水票款'},
            {value:parseFloat(money.total_order), name:'订单款'}
        ]
    }

    $(function(){
        canvasDoublePie(revenuePie)//营收统计（总）饼图
        canvasLine(revenueLine)//营收统计折线图
        canvasPie(moneyPie)//支付方式（总）饼图
        canvasLine(moneyLine)//支付方式统计 折线图
        canvasPie(moneyCatePie)// 款项分类统计 柱图
        canvasBar(goodsBar)//商品细分统计 柱图
    });

</script>
